package cn.edu.lingnan.lsqn.service;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import cn.edu.lingnan.lsqn.dao.CandidateDao;
import cn.edu.lingnan.lsqn.model.Candidate;
import cn.edu.lingnan.lsqn.model.CandidateType;

@Service("candidateService")
public class CandidateService implements ICandidateService {

	private CandidateDao candidateDao;
	
	public CandidateDao getCandidateDao() {
		return candidateDao;
	}
	
	@Inject
	public void setCandidateDao(CandidateDao candidateDao) {
		this.candidateDao = candidateDao;
	}

	@Override
	public void add(Candidate ctype) {
		candidateDao.add(ctype);
	}

	@Override
	public void delete(int id) {
		candidateDao.delete(id);
	}

	@Override
	public void update(Candidate ctype) {
		candidateDao.update(ctype);
	}

	@Override
	public Candidate load(int id) {
		return candidateDao.load(id);
	}

	@Override
	public List<Candidate> listByCandidateType(CandidateType type) {
		return candidateDao.listByCandidateType(type);
	}

	@Override
	public void addVote(int id) {
		candidateDao.addVote(id);
	}

	@Override
	public void cutVote(int id) {
		candidateDao.cutVote(id);
	}

}
